All Questions
Tagged with interview-questionsjava
357 questions
0votes
3answers
175views
Java exceptions that show the message when converted to String
I’m working with custom exceptions in Java for stack operations. However, I’m unsure if the exception handling is being handled properly, especially in terms of how exceptions are thrown and caught. ...
5votes
2answers
617views
Thread-safe write-efficient register() method for a Load balancer
The code below was written for an interview question of designing a load balancer with only a register() method. ...
2votes
2answers
129views
A thread-safe performant Money Transfer API in Java
This is a popular interview question. It is meant to be done within 30 minutes. The task is to implement a thread-safe performant Bank Account API that allows to transfer, deposit, withdraw and check ...
7votes
2answers
1kviews
A thread-safe performant URL Shortener in Java
This is a popular interview question. It is meant to be done within 45 minutes. The task is to implement a thread-safe performant in-memory URL Shortener. My implementation is based on two maps that ...
4votes
6answers
1kviews
Reverse string with identical spaces as in original String using Java
This is interview question Reverse string with identical spaces as in original String using Java For example Original String : best in the world and is greatest and is making sure the world goes well ...
2votes
1answer
57views
Implement simplified liquibase
I attended job interview and on live codeing session was asked to implement code based on some requirements. There are quite long text description but idea that we have to accept some file system path ...
10votes
6answers
5kviews
Conway's Game of Life Object oriented implementation in Java
I have designed Conway's Game of Life in Java, the solution follows Object Oriented design and paradigm, please review and let me know the feedback Class Cell Cell ...
1vote
1answer
90views
Reverse a sublist of a singly-linked master list in constant space and maximum of one pass (Java)
So I found this funky programming challenge somewhere on Quora. The idea is to take the head of a singly-linked list, and reverse a specific sublist. The requirements are: runs in constant space, ...
3votes
3answers
459views
Find smaller angle between minute and hour hands of clock
In this code the angle between the minute and hour hands of an analog clock are found and calculated and the smaller angle between them returned. This code works perfectly and I am getting back the ...
4votes
4answers
3kviews
Model animals using inheritance in Java, revised
Yesterday I posted my first solution to an interview problem here. I am now aware that I have many weak spots in Java and need to do extensive review before tackling any more interviews. Having said ...
1vote
1answer
482views
Model animals using inheritance in Java
I was assigned the following problem: You've gone back in time to 500BC Athens and Socrates wants you to build him an app to help classify animals. Build the classes ...
6votes
1answer
1kviews
friend locator app
I was rejected after a tech screening for the following code. I mainly struggled to make the code 'production ready'. I was running out of time so I did not create a class for testing. How could I ...
2votes
3answers
867views
Chess knight move simulator
I was asked to write chess simulation of pieces as a take home interview question and was given this spec. This is what I came up with: ChessGenerator.java ...
7votes
4answers
3kviews
How can I efficiently manipulate digits in a string without using RegEx in Java?
I am reading a book with different quizzes about coding interviews. Please implement a function that increments a string based on the rules below: It should take the string of unknown length and ...
3votes
2answers
95views
Largest Sum Contiguous Subarray - Kadene's algorithm
I am looking forward to an answer to improve this code? Thanks. Test class ...